package window;
/*
物体根类
 */

import java.awt.*;

public class GameOb {
    double x, y;
    int speed;
    int width, height;
    Image ima;

    public void drawself(Graphics g) {
        g.drawImage(ima, (int)x, (int)y, null);
    }

    //重写构造函数
    public GameOb(int x, int y, int speed, int width, int height, Image ima) {
        this.x = x;
        this.y = y;
        this.speed = speed;
        this.width = width;
        this.height = height;
        this.ima = ima;
    }

    public GameOb(int x, int y, int speed, Image ima) {
        this.x = x;
        this.y = y;
        this.speed = speed;
        this.ima = ima;
    }

    //矩形碰撞检测
    public Rectangle getRec() {
        return new Rectangle((int)x, (int)y, width, height);
    }

    public GameOb() {
    }
}
